package ae.pcfc.cldos.online.common.facade.provider;

import org.springframework.transaction.annotation.Transactional;

import ae.pcfc.cldos.online.common.clddb.domain.AppMetaData;
import ae.pcfc.cldos.online.common.clddb.domain.manager.AppMetaDataDOM;
import ae.pcfc.cldos.online.common.facade.BaseFacade;
import ae.pcfc.cldos.online.common.facade.GSUpdateStatusFacade;

/**
 *
 * @author akhader
 *
 */
public class GSUpdateStatusFacadeImpl extends BaseFacade  implements GSUpdateStatusFacade{


	private AppMetaDataDOM appMetaDataDOM;
	
	public void setAppMetaDataDOM(AppMetaDataDOM appMetaDataDOM) {
		this.appMetaDataDOM = appMetaDataDOM;
	}
	
	/**
	 * @param clientRefNo
	 * @param statusCode
	 */
	@Transactional
	public void changeAppStatus(String clientRefNo,Long statusCode){
			AppMetaData appMetaData = appMetaDataDOM.getApplicationByReferenceNumber(clientRefNo);
			if(appMetaData!=null){
				appMetaData.setStatusCode(statusCode);
				appMetaDataDOM.update(appMetaData);
			}
	}
	
	/**
	 * @param clientRefNo
	 * @param wfStatus
	 */
	@Transactional
	public void changeAppWorkFlowStatus(String clientRefNo,String wfStatus){
		AppMetaData appMetaData = appMetaDataDOM.getApplicationByReferenceNumber(clientRefNo);
		if(appMetaData!=null){
			appMetaData.setWfStatus(wfStatus);
			appMetaDataDOM.update(appMetaData);
		}
	}
}
